﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusinessLayer
{
    public class ChartDataAccess
    {
        public static List<TestResultData> GetChartBusiness(DateTime fromDateTime, DateTime endDateTime, string testSeriesID, string functionalTestID)
        {
            using (Production2Entities entity = new Production2Entities())
            {
                var query = from data in entity.V_CAL_Part_Test_Result
                            where data.test_series_id == testSeriesID
                            && data.create_date >= fromDateTime
                            && data.create_date <= endDateTime && data.result_calculation != null
                            && data.functional_test_id == functionalTestID
                            select new TestResultData()
                            {
                                Year = data.create_date.Value.Year,
                                Month = data.create_date.Value.Month,
                                Day = data.create_date.Value.Day,
                                Hour = data.create_date.Value.Hour,
                                ResultValue = data.result_calculation.Value
                            };

                return query.ToList();
            }
        }

        //public static List<TestResultData> GetChartBusiness(DateTime fromDateTime, DateTime endDateTime, )
    }
}
